<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function pause(numberMillis) {
    var now = new Date();
    var exitTime = now.getTime() + numberMillis;
    
    while (true) {
         now = new Date();
         if (now.getTime() > exitTime)
             return;
    }
}

//모달창 띄우면서 n millis 동안 멈추기

function pauseWithModal(numberMillis) {
       var dialogScript = 
          'window.setTimeout(' +
          ' function () { window.close(); }, ' + numberMillis + ');';
       var result = 
       // IE
        window.showModalDialog(
          'javascript:document.writeln(' +
           '"<script>' + dialogScript + '<' + '/script>잠시만 기다려 주세요")');

       // NN
       /* openDialog(
          'javascript:document.writeln(' +
           '"<script>' + dialogScript + '<' + '/script>잠시만 기다려 주세요"',
          'pauseDialog', 'modal=1,width=10,height=10');
       */
}

	function chacek(a){
		alert(a);
		for(i=0; i<10; i++){
			alert(i);
			pause(2000);
		}
		if(a=='Y'){
			time_object=setTimeout(chacek(),200);
		}else{
			clearTimeout(time_object);
		}
	}
	function test(){
		alert("계속 체크 되는지 ??");
	}
</script>
</head>
<body>
	<button onclick="chacek('Y')">클릭</button>
	<button onclick="chacek('N')">스톱</button>
</body>
</html>